﻿var extitemlist = {
    gridDefine: {
        toolbar: { items: [toolbarBtn.addExtitem] },
        columns: [
//            { display: lang.format_id, name: 'EXT_ID', minWidth: 80 },
            { display: lang.ext_code, name: 'EXT_CODE', minWidth: 100 },
//            { display: 'id', name: 'ITEM_ID', minWidth: 80 },
            { display: lang.Extension, name: 'ITEM_CODE', minWidth: 100 },
            { display: lang.operation, name: 'DICTTYPE_ID2', minWidth: 90, align: 'center', render: linkop }
        ],
        url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
        urlType: "QueryExtItemList",
        params: function () { return $.getPara("dicttypeid"); }
    },
    init: function () {
        jsPageRender(this, true);
    },
    search: function () {
        jsPageSearch(this);
    }
};

function linkop(value, row, index) {
    return '<span><a href="javascript:void(0)" onclick="deletedictitem(\'' + row.ITEM_ID + '\');">' + lang.delete_ + '</a></span>';
}

function deletedictitem(itemid) {
    $.extend($.messager.defaults, {
        ok: lang.ok,
        cancel: lang.cancel
    });
    $.confirm(lang.Sure_to_delete_element, lang.Delete_element, function (b) {
        if (b) {
            $.ajaxHandler({
                url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
                urlType: "EditExtItem",
                model: function () { return $.toJSON({ 'action': 0, 'ITEM_ID': itemid }); },
                success: function (data) {
                    if (data) {
                        $.alert(lang.Successfully_deleted, null, function () { $.closePage(); extitemlist.search(); });
                    }

                }
            });
        }
    });
}